/** \file
* Declaration of the default Twitter element database class.
* This file is part of Chorus, available at
* http://code.google.com/p/chorus-twitter/ . This file and all associated files
* and derivative works are bound by the terms of the LGPL 3.0 license,
* available at http://www.gnu.org/licenses/lgpl-3.0-standalone.html .
* \par Subversion URL:
* \$URL: http://chorus-twitter.googlecode.com/svn/branches/cpp/src/xml/DefaultTree.hpp $
* \version \$Rev: 153 $
* \date    \$Date: 2010-04-06 07:43:42 +0000 (Tue, 06 Apr 2010) $
*/

#pragma once

#include "xml/XmlTree.hpp"
#include "system/CurlGlob.hpp"

/// The default Twitter element database class. Loads from a file, updates from
/// a URL. Uses virtual inheritance because of the diamond XmlTree ->
/// TypedXmlTree/DefaultTree -> StatusTree,UserTree,DmTree.
class DefaultTree : public virtual XmlTree
{
protected:
	/// The constructor. Cannot be called directly.
	/// \param curlGlobInit The curl globals pointer.
	DefaultTree(CurlGlob *curlGlobInit);
public:
	/// The destructor.
	virtual ~DefaultTree() {}

protected:
	/// Perform the load operation.
	/// \return True for success.
	virtual bool loadPerform();

	/// Perform the update operation.
	/// \return True for success.
	virtual bool updatePerform();

	/// Perform the save operation.
	/// \return True for success.
	virtual bool savePerform();

	/// Get the file path for this database.
	/// \return The file path string.
	virtual const char *getFilePath() const = 0;

	/// Get the URL path for this database.
	/// \return The URL path string.
	virtual const char *getUrlPath() const = 0;

private:
	/// The curl globals object.
	CurlGlob *const curlGlob;
};
